﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ReportViewer.aspx.cs" Inherits="SalePriceSystem.Page.ReportViewer"
    UICulture="th" Culture="th-TH" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    
    <script src="/lib/js/jquery-latest.js" type="text/javascript"></script>
    <script src="/lib/js/jquery-ui-1.8.18.custom.min.js" type="text/javascript"></script>
    <script src="/Scripts/jquery.ui.datepicker-th.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="/lib/css/layout-default-latest.css" />
    <link rel="stylesheet" type="text/css" href="/lib/css/themes/base/jquery.ui.all.css" />
    <style type="text/css">
        .style1
        {
            width: 113px;
        }
        .style2
        {
            width: 182px;
        }
        .style3
        {
            width: 119px;
        }
    </style>
    
    <script type="text/javascript">
        $(function () {
            //$(".DateFromClass").datepicker({ regional: "th" });
            // $(".DateToClass").datepicker({ regional: "th" });

            $(".DateFromClass").datepicker($.datepicker.regional['th']);
            $(".DateToClass").datepicker($.datepicker.regional['th']);

            if ($.browser.mozilla) {
                //var reportname = "<%= ReportViewer1.ClientID %>";
                //alert(reportname);
                $("#ReportViewer1_ctl05_ctl05_ctl00_ctl00").parent().parent().parent().parent().parent().parent().parent().append("<input style='margin-top:5px;' id='Button1' type='image' src='/images/print.gif' value='button' onclick='callPrint();' />");
                $("#ReportViewer1_ctl06_ctl05_ctl00").parent().parent().parent().parent().parent().parent().parent().append("<input style='margin-top:5px;' id='Button1' type='image' src='/images/print.gif' value='button' onclick='callPrint();' />");
                
            }
        });

        function callPrint() {
            var winPrint = window.open('\Printff.aspx', '', 'left=0,top=0,width=800,height=600,toolbar=0,scrollbars=0,status=0');
        }

     

	</script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div id="reportSelectiong">
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
            <asp:ListItem Selected="True" Value="Report1">Report Lastest Price For Customer</asp:ListItem>
            <asp:ListItem Value="Report2">Report Document</asp:ListItem>
        </asp:DropDownList>
       
    </div>
    <br />
    <div id="parameter" runat="server" >
        <table style="width: 100%;">
            <tr>
                <td class="style1">
                    Application:
                </td>
                <td class="style2">
                    &nbsp;<asp:DropDownList ID="DropDownList3" runat="server" 
                        AutoPostBack="True" onselectedindexchanged="DropDownList3_SelectedIndexChanged">
                        <asp:ListItem Selected="True" Value=" ">All</asp:ListItem>      
                        <asp:ListItem Value="01">ราคาส่วนลดรายลูกค้า</asp:ListItem>
                        <asp:ListItem Value="02">ราคาส่วนลดรายกลุ่มสินค้า</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td class="style3">
                    &nbsp;&nbsp; UserName:
                </td>
                <td>
                    <asp:TextBox ID="TextBoxSale" runat="server"></asp:TextBox>
                &nbsp;SaleGroup :<asp:TextBox ID="TextBoxSalegrp" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    Status:
                </td>
                <td class="style2">
                    &nbsp;<asp:DropDownList 
                        ID="DropDownListStatus" runat="server" AutoPostBack="True" 
                        onselectedindexchanged="DropDownListStatus_SelectedIndexChanged">
                              <asp:ListItem Selected="True" Value="00">All</asp:ListItem>      
                    </asp:DropDownList>
                </td>
                <td class="style3">
                    &nbsp;&nbsp; 
                    Create From:
                </td>
                <td>
                    <asp:TextBox ID="TextBox1" runat="server" CssClass="DateFromClass"></asp:TextBox>
&nbsp;To:
                    <asp:TextBox ID="TextBox2" runat="server" CssClass="DateToClass" ></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    &nbsp;</td>
                <td class="style2">
                    &nbsp;
                </td>
                <td class="style3">
                    &nbsp;
                </td>
                <td>
                    &nbsp;<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Run Report" />
                </td>
            </tr>
        </table>
    </div>
    <div id="btnprinter"> </div>
    <div>
        <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt"
            InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt"
            Height="100%" Width="100%">
            <LocalReport ReportPath="Reports\ReportLastestNdPrice.rdlc">
                <DataSources>
                    <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetlastestRoundNDPric"
            TypeName="Controller.Helper.NDPrice"></asp:ObjectDataSource>
    </div>
    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="getAllDocument"
        TypeName="Controller.Helper.Document">
        <SelectParameters>
            <asp:Parameter DefaultValue="@doctypeid" Name="doctype" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    </form>
</body>
</html>
